#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
ll a[N];
bool cmp(int x, int y)
{
	return x > y;
}
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int n;
		cin >> n;
		for (int i = 1; i <= n; i++)
			scanf("%lld", &a[i]);
		sort(a + 1, a + 1 + n, cmp);
		ll maxx = 0;
		maxx = max( a[1] * a[2],a[n - 1] * a[n] );
		printf("%lld\n", maxx);
	}
	return 0;
}